import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
import Login from '@/views/login/index.vue'
import Layout from '@/views/layout/index.vue'
import Home from '@/views/home/index.vue'
import Wend from '@/views/wend/index.vue'
import Video from '@/views/video/index.vue'
import My from '@/views/my/index.vue'
import Search from '@/views/search/index.vue'
import Article from '@/views/article/index.vue'
import UserProfile from '@/views/user-profile/index.vue'
import HomePage from '@/views/user/index.vue'
const routes = [
  {
    path:'/login',
    name:'login',
    component:Login,
  },
  {
    path:'/',
    name:'layout',
    component:Layout,
    children:[
      {
        path:'',
        redirect:'/home'
      },
      {
        path:'/home', //默认子路由
        name:'home',
        component:Home
      },
      {
        path:'wend',
        name:'wend',
        component:Wend
      },
      {
        path:'video',
        name:'video',
        component:Video
      },
      {
        path:'my',
        name:'my',
        component:My
      }
    ]
  },
  {
    path:'/search',
    name:'search',
    component:Search
  },
  {
    path:'/article/:articleId',
    name:'article',
    component:Article,
    props:true //开启路由传参
  },
  {
    path:'/user/profile',
    name:'user_profile',
    component:UserProfile
  }
]

const router = new VueRouter({
  routes
})

export default router
